home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 August: Tool Chest / Dev.CD Aug 00 TC Disk 2.toast / pc / sample code / networking / pgpuam / sources / taboutboxpane.cp < prev    next >
Encoding:
Text File  |  2000-06-23  |  4.0 KB  |  155 lines

  1. //    TAboutBoxPane.cp -  AppleShare IP Dialog Pane Object
  2. // 
  3. // Apple Macintosh Developer Technical Support
  4. // Written by:  Vinnie Moscaritolo
  5. //
  6. //  Copyright (work in progress)  Apple Computer, Inc All rights reserved.
  7. //
  8. // You may incorporate this sample code into your applications without
  9. // restriction, though the sample code has been provided "AS IS" and the
  10. // responsibility for its operation is 100% yours.  However, what you are
  11. // not permitted to do is to redistribute the source as "DSC Sample Code"
  12. // after having made changes. If you're going to re-distribute the source,
  13. // we require that you make it clear in the source that the code was
  14. // descended from Apple Sample Code, but that you've made changes.
  15. // 
  16.  
  17.  
  18.  
  19. #include <Appearance.h>
  20.  
  21. #include "TAboutBoxPane.h"
  22. #include "ICAPI.h"
  23.  
  24. #define PGP_MACINTOSH 1
  25. #include "pgpFeatures.h"
  26.  
  27. static enum{
  28.     kAboutBoxPanePaneDITL    = 142,
  29. };
  30.  
  31. #define kAboutTextStringsID 142 
  32.  
  33. static enum {
  34.     kCreditsText          =1,
  35.     kAPICreditsText ,
  36.     kAuthorURL,
  37.     kTitleURL,
  38.      };
  39.  
  40. enum
  41. {
  42.     kAuthorClick = 1,
  43.     kTitleClick,
  44.     kPictureItem,
  45.     kBorderItem,
  46.     kCreditsTxtItem,
  47.     kCreditsTxtItem2
  48.   };
  49.  
  50.   
  51.  // ---------------------------------------------------------------------------
  52. TAboutBoxPane::TAboutBoxPane( DialogPtr dialog, SInt16 items  )
  53.                     : TPane (dialog, items) 
  54. // ---------------------------------------------------------------------------
  55. //
  56. {    
  57.  
  58.     ControlFontStyleRec    fontInfo;
  59.     Str255                 text;
  60.       Str255                sdkInfo ;
  61.     ControlHandle        theControl;
  62.      
  63.     AppendDialogItemList(dialog, kAboutBoxPanePaneDITL, overlayDITL );
  64.  
  65.     fontInfo.flags = kControlUseFontMask;
  66.     fontInfo.font = kControlFontSmallSystemFont;
  67.  
  68.     GetIndString(text, kAboutTextStringsID, kCreditsText);
  69.     GetDialogItemAsControl( dialog, items + kCreditsTxtItem,     &theControl );
  70.     SetControlData( theControl, 0, kControlStaticTextTextTag, text[0], (Ptr)(text+1));
  71.     SetControlData( theControl, 0, kControlStaticTextStyleTag, sizeof fontInfo, (Ptr)&fontInfo);
  72.  
  73.      GetIndString(text, kAboutTextStringsID, kAPICreditsText);
  74.     PGPGetSDKString((char*)sdkInfo) ;
  75.     c2pstr((char*)sdkInfo);
  76.     
  77.     PLstrcat(text,  sdkInfo);
  78.     GetDialogItemAsControl( dialog, items + kCreditsTxtItem2,     &theControl );
  79.     SetControlData( theControl, 0, kControlStaticTextTextTag, text[0], (Ptr)(text+1));
  80.     SetControlData( theControl, 0, kControlStaticTextStyleTag, sizeof fontInfo, (Ptr)&fontInfo);
  81.  
  82.  
  83.     
  84. }    
  85.  
  86.  
  87.  
  88. // ---------------------------------------------------------------------------
  89. TAboutBoxPane::~TAboutBoxPane()
  90. // ---------------------------------------------------------------------------
  91. //
  92. {     
  93.      
  94.      ShortenDITL( fDialog, CountDITL(fDialog) - fOrigItems);
  95. }
  96.  
  97.  
  98. // ---------------------------------------------------------------------------
  99. void TAboutBoxPane::Refresh(void)
  100. // ---------------------------------------------------------------------------
  101. //
  102. {     
  103. }
  104.  
  105.  
  106. // ---------------------------------------------------------------------------
  107. void TAboutBoxPane::Idle(void)
  108. // ---------------------------------------------------------------------------
  109. //
  110. {     
  111.  
  112. }
  113.  
  114.  
  115. // ---------------------------------------------------------------------------
  116. void TAboutBoxPane::ItemHit(SInt16 item)
  117. // ---------------------------------------------------------------------------
  118. //
  119. {     
  120.     SInt16            localItem;
  121.     Boolean         enable;
  122.     Str255             text;
  123.     ICInstance         icp;
  124.     long            startSel;
  125.     long             endSel;
  126.     
  127.     localItem = item - fOrigItems;
  128.     
  129.     switch ( localItem )
  130.     {
  131.               case kAuthorClick:    
  132.                   ICStart(&icp, (unsigned long)'????');
  133.                 ICFindConfigFile(icp, 0, nil);
  134.                  GetIndString(text, kAboutTextStringsID, kAuthorURL);
  135.                 startSel     = 0;
  136.                 endSel         = text[0];        
  137.                  ICLaunchURL(icp,"\pmailto:",  (char *) &text[1], text[0], &startSel, &endSel);
  138.                  ICStop(icp);
  139.                  break;
  140.                  
  141.              case kTitleClick:
  142.                   ICStart(&icp, (unsigned long)'????');
  143.                 ICFindConfigFile(icp, 0, nil);
  144.                  GetIndString(text, kAboutTextStringsID, kTitleURL);
  145.                 startSel     = 0;
  146.                 endSel         = text[0];        
  147.                  ICLaunchURL(icp,"\p",  (char *) &text[1], text[0], &startSel, &endSel);
  148.                  ICStop(icp);
  149.                   break;
  150.      
  151.      }
  152.  
  153. }
  154.  
  155.